<% content_for :javascript do %>
<%= javascript_include_tag 'dcmgr_gui/backup_panel.js' %>
<script type="text/javascript">
  jQuery(function($){
  dcmgrGUI.backupPanel();
  });
</script>
<% end %>
<% content_for :stylesheet do %>
<style type="text/css">
  .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { text-align:center; float: none;}
  .ui-dialog .ui-dialog-content {margin:5px;}
</style>
<% end %>
<div id="mainarea_wide">
  <h3><img src="images/icon_resource.gif" /><%= t("backups.header") %><a href="javascript:void(0);" class="showhide"></a></h3>
  <div  id="list_load_mask" class="maincontent">
    <div class="controller clearfix">
      <a href="javascript:void(0);" class="create_volume" style="margin-left:7px"><%= t("backups.button.create_volume") %></a>
      <a href="javascript:void(0);" class="delete_backup"><%= t("backups.button.delete_backup") %></a>
      
      <a href="javascript:void(0);" class="refresh" style="margin-left:585px"><%= t("button.refresh") %></a>
    </div>
    <div class="controller clearfix">
      <!-- <div class="l_float">
				<span class="text">Viewing:</span>
				<select class="select">
	  			<option>All Volumes</option>
				</select>
				<input type="text" class="search" />
      </div> -->
      <div id="pagenate" class="r_float">
	<a href="javascript:void(0);" class="prev"></a>
	<p id="viewPagenate"></p>
	<a href="javascript:void(0);" class="next"></a>
      </div>
    </div>
    <div id="display_backups" class="display_area">
      <% content_for :javascript_template do %>
      <script id="backupsListTemplate" type="text/x-jquery-tmpl">
	<table class="ptn01" frame="void" cellpadding="0" cellspacing="0" border="0">
	  <tr>
	    <th></th>
	    <th><%= t("backups.list.display_name") %></th>
	    <th><%= t("backups.list.capacity") %></th>
	    <th><%= t("backups.list.created_at") %></th>
	    <th><%= t("backups.list.status") %></th>
	    <th><%= t("backups.list.progress") %></th>
	    <th><%= t("backups.list.action") %></th>
	  </tr>
	  {{each(index,item) rows}}
	  <tr id="row-${item.uuid}">
	    {{if item.uuid }}
            <td class="listcheckbox"><input type="checkbox" value="${item.uuid}" > </td>
            {{else}}
            <td class="listcheckbox"></td>
            {{/if}}
	    <td class="vtip" title="display name">${item.display_name}</td>
	    <td class="vtip center" title="capacity">${displayDiskSize(this.size)}</td>
	    <td class="vtip" title="created at">${item.created_at}</td>
	    <td class="state vtip center" title="status">${item.state}</td>
            {{if item.progress }}
	    <td class="center" title="status">${item.progress}%</td>
            {{else}}
	    <td class="center" title="status"></td>
            {{/if}}
	    {{if item.uuid }}
	    <td class="vtip center" title="action">
	      {{if item.state != "deleted" }}
	      <a href="javascript:void(0);" class="edit_backup" id="edit_${item.uuid}"><%= t('volumes.button.edit_volume') %></a>
	      {{else}}
	      <a href="javascript:void(0);" class="edit_backup"><%= t('volumes.button.edit_volume') %></a>
	      {{/if}}
	    </td>
	    {{else}}
	    <td class="vtip center" title="action"></td>
	    {{/if}}
	  </tr>
	  {{/each}}
	</table>
      </script>
      <% end %>
    </div>
  </div>
  <div id="btm_maincontent_wide"></div>
  <h3><img src="images/icon_ttl_detail.gif" /><%= t("backups.details.header") %><a href="javascript:void(0);" class="showhide"></a></h3>
  <div id="detail" class="maincontent">
    <% content_for :javascript_template do %>
    <script id="backupsDetailTemplate" type="text/x-jquery-tmpl">
      <div id="${item.uuid}" class="display_area">
	<h4 class="ptn01"><%= t("backups.details.backup_object_id") %>:<span class="instansid">${item.uuid}</span></h4>
	<table class="ptn02" frame="void" cellpadding="0" cellspacing="0" border="0">
	  <tr>
	    <td class="padcell"></td>
	    <td class="title"><%= t("backups.details.display_name") %>:</td>
	    <td>${item.display_name}</td>
	    <td class="padcell"></td>
	    <td class="title"><%= t("backups.details.capacity") %>:</td>
	    <td>${item.size}</td>
          </tr>
          <tr>
            <td class="padcell"></td>
            <td class="title"><%= t("backups.details.status") %>:</td>
            <td class="state">${item.state}</td>
            <td class="padcell"></td>
            <td class="title"><%= t("backups.details.backup_storage_id") %>:</td>
	    {{if item.backup_storage_id }}
            <td class="state">${item.backup_storage_id}</td>
            {{else}}
            <td class="state"> - </td>
            {{/if}}
          </tr>
          <tr>
            <td class="padcell"></td>
            <td class="title"><%= t("backups.details.origin_volume_id") %>:</td>
            <td>${item.origin_volume_id}</td>
            <td class="padcell"></td>
            <td class="title"><%= t("backups.details.progress") %>:</td>
            <td class="state" colspan="7">${item.progress}%</td>
	  </tr>
	  <tr>
            <td class="padcell"></td>
            <td class="title"><%= t("backups.details.checksum") %>:</td>
            <td class="state" colspan="7">${item.checksum}</td>
          </tr>
	  <tr>
            <td class="padcell"></td>
            <td class="title"><%= t("backups.details.description") %>:</td>
            <td class="description" colspan="7">${item.description}</td>
          </tr>
          <tr>
	    <td class="padcell"></td>
            <td class="title"><%= t("backups.details.created_at") %>:</td>
            <td colspan="7">${item.created_at}</td>
	  </tr>
          <tr>
	    <td class="padcell"></td>
            <td class="title"><%= t("backups.details.updated_at") %>:</td>
            <td colspan="7">${item.updated_at}</td>
	  </tr>
	</table>
      </div>
    </script>
    <% end %>
  </div><!-- maincontent -->
  <div id="btm_maincontent_wide_last"></div>
</div><!-- mainarea_wide -->
